#ifndef WXSFONTPROPERTY_H
#define WXSFONTPROPERTY_H

#include "../../properties/wxsproperties.h"
#include "../wxscodercontext.h"


struct wxsFontData {
  long Size;
  wxFontStyle Style;
  wxFontWeight Weight;
  bool Underlined;
  wxFontFamily Family;
  wxArrayString Faces;
  wxString Encoding;
  wxString SysFont;
  double RelativeSize;

  bool IsDefault : 1;
  bool HasSize : 1;
  bool HasStyle : 1;
  bool HasWeight : 1;
  bool HasUnderlined : 1;
  bool HasFamily : 1;
  bool HasEncoding : 1;
  bool HasSysFont : 1;
  bool HasRelativeSize : 1;


  wxFont BuildFont();


  wxString BuildFontCode( const wxString& FontName, wxsCoderContext* Context );


  wxsFontData():
    Size( 12 ),
    Style( wxFONTSTYLE_NORMAL ),
    Weight( wxFONTWEIGHT_NORMAL ),
    Underlined( false ),
    Family( wxFONTFAMILY_DEFAULT ),
    IsDefault( true ),
    HasSize( false ),
    HasStyle( false ),
    HasWeight( false ),
    HasUnderlined( false ),
    HasFamily( false ),
    HasEncoding( false ),
    HasSysFont( false ),
    HasRelativeSize( false ) {}

};


class wxsFontProperty: public wxsCustomEditorProperty {
  public:


    wxsFontProperty(
      const wxString& PGName,
      const wxString& DataName,
      long Offset,
      int Priority = 100 );


    virtual const wxString GetTypeName() { return _T( "wxFont" ); }


    virtual bool ShowEditor( wxsPropertyContainer* Object );

  protected:

    virtual bool XmlRead( wxsPropertyContainer* Object, TiXmlElement* Element );
    virtual bool XmlWrite( wxsPropertyContainer* Object, TiXmlElement* Element );
    virtual bool PropStreamRead( wxsPropertyContainer* Object, wxsPropertyStream* Stream );
    virtual bool PropStreamWrite( wxsPropertyContainer* Object, wxsPropertyStream* Stream );
    virtual wxString GetStr( wxsPropertyContainer* Object );

  private:

    long Offset;
};




#define WXS_FONT(ClassName,VarName,PGName,DataName) \
  { static wxsFontProperty _Property(PGName,DataName,wxsOFFSET(ClassName,VarName)); \
    Property(_Property); }


#define WXS_FONT_P(ClassName,VarName,PGName,DataName,Priority) \
  { static wxsFontProperty _Property(PGName,DataName,wxsOFFSET(ClassName,VarName),Priority); \
    Property(_Property); }




#endif
